{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Selecting Suppliers\n", "## Problem Definition\n", "Your company, Altered Silicon, manufactures solar energy panels, and it has received an urgent order for 40 panels from a new German customer which is willing to pay 1,000€ per panel. Altered Silicon has committed its production capacity to other orders, and the only alternative left to serve the new order is to subcontract the production involved.\n", "\n", "Altered Silicon has located two possible suppliers: \n", " - Supplier A: based in Romania, placed an offer of 500€ per panel \n", " - Supplier B: from Poland, which would sell each panel for 550€ \n", " \n", "The cost to transport one batch of 40 panels from either of the\n", "two suppliers to the German firm is 1,000€. Nonetheless, the customer’s technical specifications are very demanding, so Altered Silicon estimates that Supplier A could supply one correct batch with a probability of 70%, whereas Supplier B could do it with a probability of 80 %. If the batch were incorrect, Altered Silicon could sell it to another customer at the price of 200€ per\n", "panel.\n", "Altered Silicon is considering the possibility of asking for a test panel from each supplier to test it before placing an order. Altered Silicon’s testing system guarantees that a faulty panel is always detected, while there is a 5% margin of error with correct panels.\n", "The testing system is prepared to assess two test panels, and the overall cost (cost of the two panels + transport + cost of the test) comes to 2,000€.\n", "\n", "**a** Draw the corresponding decision tree and indicate with a letter per branch the associated probability or the associated cost (depending on the case)\n", "\n", "The company needs to decide whether to conform the test panel or not. So the alternatives for the first decision node are: \n", "\n", "- Not conform test panel: Cost 0\n", "- Conform test panel: Cost CP= 2K€ \n", "\n", "The test panel will provide additional information on the possibility that the batches provided by each provider are bad. The outcome of the test panel can be modeled as a random node with 4 possible outcomes: \n", "\n", "- The test on the sample from supplier A is correct (PAC), with Probability P(PAC) and the test on the sample from supplier B is correct (PBC), with probability P(PBC): P(PAC)*P(PBC)\n", "- The test on the sample from supplier A is correct (PAC), with Probability P(PAC) and the test on the sample from supplier B is incorrect (PBI), with probability P(PBI): P(PAC)*P(PBI)\n", "- The test on the sample from supplier A is incorrect (PAI), with Probability P(PAI) and the test on the sample from supplier B is correct (PBC), with probability P(PBC): P(PAI)*P(PBC)\n", "- The test on the sample from supplier A is incorrect (PAI), with Probability P(PAI) and the test on the sample from supplier B is incorrect (PBI), with probability P(PBI): P(PAI)*P(PBI)\n", "\n", "In the probabilities above, we assumed that the results on the samples from different suppliers are independent events. \n", "\n", "Let us assume that the 3 alternatives for the company are: \n", "\n", "- Select supplier A (Supplier A): CA = -(0.5*40)-1=-21\n", "- Select supplier B (Supplier B): CB = -(0.55*40)-1=-23\n", "- Do not purchase from any supplier (No supplier): CN = 0\n", "\n", "Now, if we select provider A, the batch may be correct or incorrect. This event can be modeled as a random node with the following alternatives and corresponding initial probabilities:\n", "\n", "- Batch is correct (AC), with probability P(AC)=0.7\n", "- Batch is incorrect (AI), with probability P(AI) = 0.3\n", " \n", "Similarly, for player B, the batch may also be correct or incorrect, with (a priori) probabilities:\n", "\n", "- Batch is correct (BC), with probability P(BC)=0.8\n", "- Batch is incorrect (BI), with probability P(BI) = 0.2\n", "\n", "Now, the problem also gives some conditional probabilities on further information, related to the reliability of the test. From historic results, the probability that a test gave an incorrect result given that the batch was correct is 0.05. Hence:\n", "\n", "- P(PAC|AC) = 0.95\n", "- P(PAI|AC) = 0.05\n", "- P(PBC|BC) = 0.95\n", "- P(PBI|BC) = 0.05\n", "\n", "Likewise, in the past, the test has never given an incorrect result and therefore:\n", "\n", "- P(PAC|AI) = 0\n", "- P(PAI|AI) = 1\n", "- P(PBC|BI) = 0\n", "- P(PBI|BI) = 1\n", "\n", "By applying the Bayes rule, the probabilities of occurrence of the test results are:\n", "\n", "P(PAC) = P(PAC|AC)*P(AC) + P(PAC|AI)*P(AI) = 0.665\n", "P(PAI) = 1-P(PAC) = 0.335\n", "P(PBC) = P(PBC|BC)*P(BC) + P(PBC|BI)*P(BI) = 0.76\n", "P(PAI) = 1-P(PBC) = 0.24\n", "\n", "Which yields:\n", "\n", "P(PAC)*P(PBC) = 0.5054\n", "P(PAC)*P(PBI) = 0.1596\n", "P(PAI)*P(PBC) = 0.254\n", "P(PAI)*P(PBI) = 0.0804\n", "\n", "And applying Bayes yields\n", "\n", "P(AC|PAC) = 1\n", "P(AI|PAC) = 0\n", "P(AC|PAI) = 0.1045\n", "P(AI|PAI) = 0.8955\n", "\n", "P(BC|PBC) = 1\n", "P(BI|PBC) = 0\n", "P(BC|PBI) = 0.1667\n", "P(BI|PBI) = 0.8333\n", "\n", "Finally, we have the following outcomes in the different leave nodes:\n", "- When the batch is correct GC=40K€\n", "- When the batch is incorrect GI=8K€\n", "- No purchase = 0\n", "\n", "![Decision tree](img/selecting_suppliers.PNG)\n", "\n", "**b** Solve the decision tree\n", "To solve, the decision tree, we need to calculate the expected value of random nodes, and select the alternative that provides the maximum benefit (outcome minus cost) in decision nodes. The following figure shows the solution of obtained in the decision tree:\n", "\n", "![Decision tree](img/selecting_suppliers_solved.PNG)\n", " \n", "**c** Up to how much should SUN2 pay for the test?\n", "\n", "The company could pay p to the difference between the values of the nodes of the two alternatives, without or with test: \n", "\n", "16.96 - 10.60 = 6.36" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" }, "pycharm": { "stem_cell": { "cell_type": "raw", "source": [], "metadata": { "collapsed": false } } } }, "nbformat": 4, "nbformat_minor": 2 }